<?php
/**
 * Created by PhpStorm.
 * User: sMile
 * Date: 16/5/14
 * Time: 上午8:11
 */


require_once('connect.php');
require_once('AES.php');
//print_r($_POST);
//print_r($_GET);
//$result = mysqli_query($link,"select * from secKill");
//print(json_encode(mysqli_fetch_all($result,MYSQLI_ASSOC)));
/**

$str = '我是明文我是明文我是明文我是明文我是明文dsfdghgasdfasdddddddd';
$key = 'aSGJLGYEWERWRREW4567i8o';

$str1=AES::encode($key, $str);
$str2=AES::decode($key, $str1);


echo '<xmp>';
var_dump($str);
var_dump($str1);
var_dump($str2);
var_dump(rtrim($str2));
 *
 * */

if(!$userName = $_POST['userName']){
    $userName = $_GET['userName'];
}
if(!$password = $_POST['password']){
    $password = $_GET['password'];
}

if($result = mysqli_fetch_row(mysqli_query($link,"select * from user where name='$userName' and password='$password'"))){
    //print_r($result);
    echo '0';
}else{
    echo 'failed';
}

